/*
 * XiangTest.cpp
 *
 *  Created on: 2011-7-31
 *      Author: Administrator
 */


#include "gtest/gtest.h"
#include "../src/Situation.h"
#include "../src/RedBing.h"
#include "../src/BlackBing.h"
#include "../src/RedXiang.h"

TEST(XiangTest,NoChessInWayActions){
	RedXiang xiang;
	std::vector<Action> actions;
	Position pos(2,0);
	Situation situation;
	situation.AddChess(&xiang,pos);
	SituationProjection projection;
	situation.GetProjection(projection);
	xiang.GenActions(actions,pos,projection);
    EXPECT_EQ(2,actions.size());
    EXPECT_EQ(Action(Position(2,0),Position(4,2)),actions[0]);
}

TEST(XiangTest,HaveChessInWayActions){
	RedXiang xiang;
	std::vector<Action> actions;
	Position pos(2,0);
	Situation situation;
	situation.AddChess(&xiang,pos);

	RedBing bing;
	Position posBing(3,1);
	situation.AddChess(&bing,posBing);

	SituationProjection projection;
	situation.GetProjection(projection);
	xiang.GenActions(actions,pos,projection);
    EXPECT_EQ(1,actions.size());
    EXPECT_EQ(Action(Position(2,0),Position(0,2)),actions[0]);
}



